package com.airlines.crewassignment.service.basicinfo.impl;

import com.airlines.common.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.airlines.crewassignment.service.basicinfo.OvernightAirportService;
import com.airlines.crewassignment.entity.basicinfo.OvernightAirport;
import java.util.List;
import com.airlines.crewassignment.dao.basicinfo.OvernightAirportMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * @author xxxx
 * @date 2018/06/05 10:53:58
 * @company xxxx Airlines
 * @description 
 */
@Service
public class OvernightAirportServiceImpl implements OvernightAirportService {

    @Autowired
    private OvernightAirportMapper overnightAirportMapper;

    @Override
    public int insert(OvernightAirport overnightAirport){
        return overnightAirportMapper.insert(overnightAirport);
    }

    @Override
    public int delete(String nightAirport){
        return overnightAirportMapper.delete(nightAirport);
    }


    @Override
    public int update(OvernightAirport overnightAirport){
        return overnightAirportMapper.update(overnightAirport);
    }

    @Override
    public OvernightAirport get(String nightAirport){
        return overnightAirportMapper.get(nightAirport);
    }

    @Override
    public List<OvernightAirport> list(OvernightAirport overnightAirport){
        return overnightAirportMapper.list(overnightAirport);
    }

    @Override
    public Page list(OvernightAirport overnightAirport, Page page){
        PageHelper.startPage(page.getPageNumber(), page.getPageSize());
        List<OvernightAirport> list = overnightAirportMapper.listByFuzzy(overnightAirport);
        PageInfo<OvernightAirport> pageInfo = new PageInfo<OvernightAirport>(list);
        page.setTotal(String.valueOf(pageInfo.getTotal()));
        page.setRows(pageInfo.getList());
        return page;
    }




}
